package com.hefu.virtuallife.ui.purchase;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;

import com.dz.utlis.ClassTools;
import com.dz.utlis.ScreenUtils;
import com.hefu.virtuallife.R;
import com.hefu.virtuallife.baseui.BaseActivity;
import com.hefu.virtuallife.recyclerViewdivider.HDividerItemDecoration;
import com.hefu.virtuallife.recyclerViewdivider.ScrollLinearLayoutManager;
import com.hefu.virtuallife.ui.purchase.adapter.HomePurchaseAdapter;
import com.hefu.virtuallife.ui.purchase.adapter.RouteItemAdapter;
import com.hefu.virtuallife.ui.purchase.bean.HomePurchaseBean;
import com.hefu.virtuallife.ui.purchase.bean.RouteInfo;
import com.hefu.virtuallife.utils.UiCompat;
import com.hefu.virtuallife.widget.ToolListView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.youth.banner.Banner;
import com.youth.banner.loader.ImageLoader;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * creat_user: zhengzaihong
 * email:1096877329@qq.com
 * creat_date: 2018/8/13
 * creat_time: 18:29
 * describe: 商品详情
 **/
public class GoodsDetailActivity extends BaseActivity implements OnRefreshLoadMoreListener {
    @BindView(R.id.iv_back)
    ImageButton ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;

    @BindView(R.id.lv_listview)
    ToolListView listView;

    @BindView(R.id.refreshLayout)
    SmartRefreshLayout refreshLayout;
    @BindView(R.id.scrollView)
    ScrollView scrollView;


    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_goods_detail;
    }

    private List<RouteInfo> infos = new ArrayList<>();

    @Override
    protected void initWidget() {
        super.initWidget();

        ivBack.setVisibility(View.VISIBLE);
        tvTitle.setVisibility(View.VISIBLE);
        tvTitle.setText("产品详情");
        ivBack.setOnClickListener(v -> finish());
    }

    @Override
    protected void initData() {
        super.initData();

        scrollView.smoothScrollTo(0, 0);

        refreshLayout.setOnLoadMoreListener(this);
        refreshLayout.setOnRefreshListener(this);
        refreshLayout.autoRefresh();
        refreshLayout.setEnableLoadMore(false);

        infos.add(new RouteInfo("2018年6月25日收割 晾晒 脱粒 除杂"));
        infos.add(new RouteInfo("2018年7月3日包装入仓 龙凤商品城存储仓库温度二十摄氏度 恒温 室内湿度 20 恒湿"));
        infos.add(new RouteInfo("2018年7月22日 上海市货物集散中心仓库 室内温度20c 恒温 室内湿度20 恒湿"));
        infos.add(new RouteInfo("2018年7月28日 上海市荷福基地 室内温度20c 恒温 室内湿度20 恒湿"));
        RouteItemAdapter itemAdapter = new RouteItemAdapter(mContext, infos);
        listView.setAdapter(itemAdapter);

    }

    @Override
    public void onLoadMore(RefreshLayout refreshLayout) {

    }

    @Override
    public void onRefresh(RefreshLayout refreshLayout) {
        refreshLayout.finishRefresh();
        refreshLayout.finishLoadMore();
    }

}
